/**
 *    @file       process.h
 *
 *    @brief      
 *    @details
 *
 *    @version    1.0
 *    @date       02/11/2014 03:34:33 PM
 *
 *    @author     Theophilus (), wangtf418@gmail.com
 */
#ifndef _BF_PROCESS_H_
#define _BF_PROCESS_H_
#include <vector>
#include "comdef.h"

class process
{
public:
	process();
	~process();

public:
	bf_int_t fork();
	void waitpid();

	inline bf_bool_t ifchild()
	{
		return m_ifchild;
	}

	inline bf_bool_t ifparent()
	{
		return m_ifparent;
	}

	inline std::vector<bf_pid_t> & get_childpid()
	{
		return m_childpid;
	}

public:
	static bf_pid_t getpid();
	static bf_pid_t getppid();
	static bf_pid_t waitpid(bf_pid_t pid, bf_int_t *status, bf_int_t options);

private:
	bf_bool_t m_ifparent;
	bf_bool_t m_ifchild;
	bf_bool_t m_iffork;
	std::vector<bf_pid_t> m_childpid;
	static bf_pid_t m_pid;
};

#endif

